﻿using System;
using System . Collections . Generic;
using System . IO;
using System . Linq;
using System . Runtime . InteropServices . WindowsRuntime;
using Windows . Foundation;
using Windows . Foundation . Collections;
using Windows . UI . Xaml;
using Windows . UI . Xaml . Controls;
using Windows . UI . Xaml . Controls . Primitives;
using Windows . UI . Xaml . Data;
using Windows . UI . Xaml . Input;
using Windows . UI . Xaml . Media;
using Windows . UI . Xaml . Navigation;
using WenceyWang . RichMan4L . App . Logic;


namespace WenceyWang . RichMan4L . App . Pages
{
    /// <summary>
    /// 设置页
    /// </summary>
    public sealed partial class SettingPage : Page
    {
        public SettingPage ( )
        {
            this . InitializeComponent ( );
            StartStoryBoard . Completed += StartStoryBoard_Completed;
        }

        private void StartStoryBoard_Completed ( object sender , object e )
        {
            if ( new AppSettings ( ) . OCDMode )
            {
                MainGrid . TurnOnOCDMode ( );
            }
            StartStoryBoard . Completed -= StartStoryBoard_Completed;
        }

        protected override void OnNavigatedTo ( NavigationEventArgs e )
        {
        }

        private void Page_Loaded ( object sender , RoutedEventArgs e )
        {
            StartStoryBoard . Begin ( );
        }


        private void MainPageButton_Click ( object sender , RoutedEventArgs e )
        {
            PageNavigateHelper . Navigate ( typeof ( MainPage ) , null , "Cyan" , LeaveStoryBoard , BackGroundRect , Frame , RemoveControl , AddControl );
        }
        private void AboutPageButton_Click ( object sender , RoutedEventArgs e )
        {
            PageNavigateHelper . Navigate ( typeof ( AboutPage ) , null , "Blue" , LeaveStoryBoard , BackGroundRect , Frame , RemoveControl , AddControl );
        }

        private void RemoveControl ( )
        {
            MainPageButton . Click -= MainPageButton_Click;
        }

        private void AddControl ( )
        {
            MainPageButton . Click += MainPageButton_Click;
        }
    }
}
